using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace hao_Dto.Product
{
    /// <summary>
    /// 商品留言DTO
    /// </summary>
    public class ProductCommentDto
    {
        /// <summary>
        /// 留言ID
        /// </summary>
        public Guid Id { get; set; }

        /// <summary>
        /// 商品ID
        /// </summary>
        public Guid ProductId { get; set; }

        /// <summary>
        /// 留言用户ID
        /// </summary>
        public Guid UserId { get; set; }

        /// <summary>
        /// 留言用户名
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        /// 留言内容
        /// </summary>
        public string Content { get; set; }

        /// <summary>
        /// 父留言ID（回复）
        /// </summary>
        public Guid? ParentId { get; set; }

        /// <summary>
        /// 点赞数量
        /// </summary>
        public int LikeCount { get; set; }

        /// <summary>
        /// 当前用户是否已点赞
        /// </summary>
        public bool IsLiked { get; set; }

        /// <summary>
        /// 留言创建时间
        /// </summary>
        public DateTime CreatedAt { get; set; }

        /// <summary>
        /// 回复列表
        /// </summary>
        public List<ProductCommentDto> Replies { get; set; } = new List<ProductCommentDto>();
    }

    /// <summary>
    /// 创建留言DTO
    /// </summary>
    public class CreateProductCommentDto
    {
        /// <summary>
        /// 商品ID
        /// </summary>
        [Required(ErrorMessage = "商品ID不能为空")]
        public Guid ProductId { get; set; }

        /// <summary>
        /// 留言内容
        /// </summary>
        [Required(ErrorMessage = "留言内容不能为空")]
        [StringLength(200, ErrorMessage = "留言内容不能超过200字")]
        public string Content { get; set; }

        /// <summary>
        /// 父留言ID（回复）
        /// </summary>
        public Guid? ParentId { get; set; }
    }

    /// <summary>
    /// 留言列表查询DTO
    /// </summary>
    public class ProductCommentQueryDto
    {
        /// <summary>
        /// 商品ID
        /// </summary>
        [Required(ErrorMessage = "商品ID不能为空")]
        public Guid ProductId { get; set; }

        /// <summary>
        /// 页码
        /// </summary>
        public int Page { get; set; } = 1;

        /// <summary>
        /// 每页数量
        /// </summary>
        public int PageSize { get; set; } = 20;
    }

    /// <summary>
    /// 留言列表响应DTO
    /// </summary>
    public class ProductCommentListDto
    {
        /// <summary>
        /// 留言列表
        /// </summary>
        public List<ProductCommentDto> Comments { get; set; } = new List<ProductCommentDto>();

        /// <summary>
        /// 总数量
        /// </summary>
        public int Total { get; set; }

        /// <summary>
        /// 当前页码
        /// </summary>
        public int Page { get; set; }

        /// <summary>
        /// 每页数量
        /// </summary>
        public int PageSize { get; set; }

        /// <summary>
        /// 总页数
        /// </summary>
        public int TotalPages { get; set; }
    }
}